﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        .mathSelected
        {
            background-color: #dfdfdf;
        }
    </style>
    <script src="Scripts/jquery-1.6.1.min.js" type="text/javascript"></script>
    <script src="Scripts/MathML1.js" type="text/javascript"></script>
    <script src="Scripts/MathMLEditor.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#btnFS").click(function () {
                if (currentSelectedObj == undefined) {
                    alert("未指定位置");
                    return;
                }
                var fracHtml = "<span math='frac' mathroot='true'><span></span><span>□</span><span>□</span></span>";
                if (cursorDir == 0) {
                    currentSelectedObj.prepend(fracHtml);
                }
                else if (cursorDir == 1) {
                    currentSelectedObj.append(fracHtml);
                }
                //currentSelectedObj.append(fracHtml);
                $("span[mathroot='true']").each(function () {
                    $(this).formula();
                });
            });
            $("#btnSXB").click(function () {
                if (currentSelectedObj == undefined) {
                    alert("未指定位置");
                    return;
                }
                var fracHtml = "<span math='subsup' mathroot='true'><span>□</span><span>□</span><span>□</span></span>";
                currentSelectedObj.append(fracHtml);
                $("span[mathroot='true']").each(function () {
                    $(this).formula();
                });
            });
            $("#btnKH").click(function () {
                if (currentSelectedObj == undefined) {
                    alert("未指定位置");
                    return;
                }
                var fracHtml = "<span>(<span>□</span>)</span>";
                currentSelectedObj.append(fracHtml);
//                $("span[mathroot='true']").each(function () {
//                    $(this).formula();
//                });
            });
        })
    </script>
</head>
<body>
    <div style="background-color: Gray;">
        <input id="btnFS" type="button" value="插入分数" />
        <input id="btnSXB" type="button" value="上下标" />
        <input id="btnKH" type="button" value="括号" />
    </div>
    <div>
        1111111111111111111<span math='frac' mathroot="true"><span></span><span>1</span><span>2</span></span>11111111111111111111111
        <br />
        <br />
        <span>□</span>
        <br />
        <span math='genhao' mathroot="true"><span><img src="images/gh.png" /></span><span>□</span></span>
        <br />
        <span math='integral1' mathroot="true"><span>
            <img src="images/jf1.png" /></span><span>□</span></span>
        <!--<span math="subsup" mathroot="true"><span>2</span><span>x</span><span>x</span></span>-->
    </div>
</body>
</html>
